package com.xiaozhi.controller.entitycontroller;

import com.xiaozhi.VO.CourseVo;
import com.xiaozhi.entity.Course;
import com.xiaozhi.service.CourseService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 烟尘
 * @since 2023-03-15
 * @folder 课程相关
 */
@RestController
@RequestMapping("/course")
public class CourseController {
@Autowired
private CourseService courseService;

@GetMapping("getallmes")
@ResponseBody
public List<CourseVo<Course>> getAllMes(){
    return courseService.getAllMes();
}
    @ApiOperation("得到课程信息，并且每个年级只取五个")
    @GetMapping("getFivemes")
    @ResponseBody
    public List<CourseVo<Course>> getFiveMes(){
        return courseService.getFiveMes();
    }
    @ApiOperation("随机推荐五个推荐")
    @GetMapping("getallRecommend")
    @ResponseBody
    public List<Course> getAllRecommend(){
        return courseService.getAllByRecommend();
    }
    @ApiOperation("根据课程id得到相应的信息")
    @GetMapping("getCouAndRep/{courseId}")
    @ResponseBody
    public Course getCouAndRep(@PathVariable("courseId")String id){
        return courseService.getCouAndRep(id);
    }


}
